package com.emperor.course.logic;

import java.util.ArrayList;
import java.util.List;

import com.emperor.category.logic.Category;
import com.emperor.core.logic.BizModelBase;

public class CourseModel extends BizModelBase implements Course {

	private Long id;
	private String name;
	private String desc;
	private String sku;
	private Double price;
	private Double discount;
	private Category category;
	private String status;
	private Double cost;
	private Double quantity;

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Object id) {
		if (id != null) {
			if (id instanceof Long) {
				this.id = (Long) id;
			} else {
				try {
					this.id = new Long(id.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public void setName(Object name) {
		if (name != null) {
			if (name instanceof String) {
				this.name = (String) name;
			} else {
				try {
					this.name = name.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(Object desc) {
		if (desc != null) {
			if (desc instanceof String) {
				this.desc = (String) desc;
			} else {
				try {
					this.desc = desc.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public String getSku() {
		return sku;
	}

	@Override
	public void setSku(Object sku) {
		if (sku != null) {
			if (sku instanceof String) {
				this.sku = (String) sku;
			} else {
				try {
					this.sku = sku.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public Double getPrice() {
		return price;
	}

	@Override
	public void setPrice(Object price) {
		if (price != null) {
			if (price instanceof Double) {
				this.price = (Double) price;
			} else {
				try {
					this.price = new Double(price.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public Double getDiscount() {
		return discount;
	}

	@Override
	public void setDiscount(Object discount) {
		if (discount != null) {
			if (discount instanceof Double) {
				this.discount = (Double) discount;
			} else {
				try {
					this.discount = new Double(discount.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public Category getCategory() {
		return category;
	}

	@Override
	public void setCategory(Object category) {
		if (category != null) {
			if (category instanceof Category) {
				this.category = (Category) category;
			}
		}
	}

	@Override
	public String getStatus() {
		return status;
	}
	
	@Override
	public void setStatus(Object status) {
		if (status != null) {
			if (status instanceof String) {
				this.status = (String) status;
			} else {
				try {
					this.status = status.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public Double getCost() {
		return cost;
	}
	
	@Override
	public void setCost(Object cost) {
		if (cost != null) {
			if (cost instanceof Double) {
				this.cost = (Double) cost;
			} else {
				try {
					this.cost = new Double(cost.toString());
				} catch (Exception e) {
				}
			}
		}
	}
	
	
	
	public Double getQuantity() {
		return quantity;
	}

	public void setQuantity(Object quantity) {
		if (quantity != null) {
			if (quantity instanceof Double) {
				this.quantity = (Double) quantity;
			} else {
				try {
					this.quantity = new Double(quantity.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	@Override
	public List<String> getFieldNames() {
		List<String> fieldNames = new ArrayList<String>();
		
		fieldNames.add(FLD_ID);
		fieldNames.add(FLD_NAME);
		fieldNames.add(FLD_DESC);
		fieldNames.add(FLD_PRICE);
		fieldNames.add(FLD_DISCOUNT);
		fieldNames.add(FLD_SKU);
		fieldNames.add(FLD_STATUS);
		fieldNames.add(FLD_COST);
		fieldNames.add(FLD_QUANTITY);

		fieldNames.add(FLD_CRTBY);
		fieldNames.add(FLD_CRTDATE);
		fieldNames.add(FLD_UPDBY);
		fieldNames.add(FLD_UPDDATE);
		
		
		return fieldNames;
	}

}
